home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
DELPHI32
/
GRAPHICS
/
IMGLIB95
/
UDEMO.PA_
/
UDEMO.PA
Wrap
Text File
|
1996-03-31
|
16KB
|
487 lines
{
Written by Jan Dekkers and Kevin Adams (c) 1995, 1996. If you are a non
registered client, you may use or alter this demo only for evaluation
purposes.
Copyright by SkyLine Tools. All rights reserved.
Part of Imagelib VCL/DLL Library.
}
unit Udemo;
{Includes settings to compile in either 16 or 32 bit}
{$I DEFILIB.INC}
interface
uses
{$IFDEF DEL32}
Windows,
{$ELSE}
WinTypes,
WinProcs,
{$ENDIF}
DLL95V1, {ImageLib Dll interface and misc. functions}
SysUtils,
Messages,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls,
ExtCtrls,
Buttons,
FileCtrl,
Printers,
IToolB, {PMultiImage Toolbar VCL component}
UAbout,
UImage, {PMultiImage Demo}
BImage, {Image Convert Demo}
MMBlob, {MultiMedia Blobfield Demo}
UBlob, {MultiImage Blobfield Demo}
UMail, {Demo}
UScroll, {Scrolling messages demo}
UIconLB, {Icon List/Combo Box demo}
UToolbar, {PMultiImage Toolbar demo}
Udbtoolb, {PDBMultiImage Toolbar demo}
UMdbtb, {PDBMultiMedia Toolbar demo}
UMultim, {PMultiMedia Toolbar demo}
UFGRAB, {Video Frame Grabber demo}
U_gl_pal, {Global Palette demo}
Urubberb, {PDBMultiImage Toolbar demo with Rubberband zooming}
TMultiP, {PMultiImage VCL component}
Preview;
type
TDemoForm1 = class(TForm)
Panel1 : TPanel;
SpeedButton1 : TSpeedButton;
SpeedButton2 : TSpeedButton;
SpeedButton3 : TSpeedButton;
SpeedButton4 : TSpeedButton;
SpeedButton5 : TSpeedButton;
SpeedButton6 : TSpeedButton;
SpeedButton7 : TSpeedButton;
SpeedButton14 : TSpeedButton;
SpeedButton9 : TSpeedButton;
Memo1 : TMemo;
BitBtn1 : TBitBtn;
SpeedButton10 : TSpeedButton;
SpeedButton11 : TSpeedButton;
BitBtn2 : TBitBtn;
PrintDialog1 : TPrintDialog;
Panel2 : TPanel;
PMultiImage1 : TPMultiImage;
Panel3 : TPanel;
MultiImage2 : TPMultiImage;
SpeedButton12 : TSpeedButton;
ImageToolBar1 : TMImageToolBar;
SpeedButton8 : TSpeedButton;
SpeedButton13 : TSpeedButton;
SpeedButton15 : TSpeedButton;
SpeedButton16 : TSpeedButton;
SpeedButton17 : TSpeedButton;
BitBtn3 : TBitBtn;
SpeedButton18 : TSpeedButton;
SpeedButton19 : TSpeedButton;
ThumbPreview1: TThumbPreview;
procedure FormCreate(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
procedure SpeedButton5Click(Sender: TObject);
procedure SpeedButton6Click(Sender: TObject);
procedure SpeedButton7Click(Sender: TObject);
procedure SpeedButton14Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure SpeedButton9Click(Sender: TObject);
procedure SpeedButton10Click(Sender: TObject);
procedure SpeedButton11Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure SpeedButton12Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure SpeedButton8Click(Sender: TObject);
procedure SpeedButton13Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure SpeedButton15Click(Sender: TObject);
procedure SpeedButton16Click(Sender: TObject);
procedure SpeedButton17Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure SpeedButton18Click(Sender: TObject);
procedure SpeedButton19Click(Sender: TObject);
private
{ Private declarations }
WX : Integer;
WY : Integer;
Procedure Trigger(Sender : TObject; Var Done : Boolean);
public
{ Public declarations }
end;
var
DemoForm1: TDemoForm1;
implementation
{$R *.DFM}
{---------------------------------------------------------------------}
procedure TDemoForm1.FormCreate(Sender: TObject);
begin
BForm1:=Nil;
DBMultiImageToolbar:=Nil;
MMForm1:=Nil;
MMForm3:=Nil;
RubberbandForm:=Nil;
Cursor:=crHourGlass;
PMultiImage1.ImageName:=ExtractFilePath(Application.ExeName)+'sjef.jpg';
Cursor:=crDefault;
{create a message at creation at MultiImage2 (Bottom one)}
{set Message text}
{$IFDEF DEL32}
MultiImage2.MsgText:='ImageLib 95/31 by SkyLine Tools. Add TIF, PNG, CMS, SCM, JPG, ICO, PCX, BMP, WMF and GIF images'+
' to your applications. ImageLib supports both the File and Data-Aware (BLOB) read and write.'+
' Add all the image formats and AVI, MOV, MID, RMI, WAV to a TBlobfield.'+
' In ImageLib version 95, scrolling text messages can be 64Kb long. '+
' ImageLib: Professional Version VCLs\DLL'+
' ImageLib VCLs\DLL provides an excellent tool for implementing JPEG, GIF, PCX, PNG, WMF,'+
' SCM.BMP,ICO and CMS into your applications. A royalty free VCL with source code is'+
' included for the low price of $?????. (Price may vary outside the United States.)'+
' Other image and multimedia development tools are a lot more expensive and do not include'+
' ImageLib''s much talked about scrolling text messages.'+
' When the developer compiles ImageLib into an executable application with the extension exe.,'+
' there are no licensing fees or royalties.'+
' When users compared ImageLib''s color resolution with other imaging tools, they found ImageLib''s'+
' to be superior to most. In fact, the JPEG is so professional looking that museums are using it'+
' to catalogue their art.'+
' Also, ImageLib adds DBMultiImage and DBMultiMedia to store and display JPEG, BMP, GIF, PNG,'+
' CMS, SCM, PCX , AVI, MOV, MID, WAV and RMI multimedia files in/from a TBlobField.'+
' International developers are able to display strings in the DLL as a resource file,'+
' thereby enabling translation into foreign languages.'+
' SkyLine Tools stands behind its product with its highly responsive technical support.';
{$ELSE}
MultiImage2.MsgText:='ImageLib 95/31 by SkyLine Tools. Add TIF, PNG, CMS, SCM, JPG, ICO, PCX, BMP, WMF, GIF images'+
' to your applications. ImageLib supports both the File and Data-Aware (BLOB) read and write.'+
' Add all the image formats and AVI, MOV, MID, RMI, WAV to a TBlobfield.';
{$ENDIF}
{set Message font name; Note you can alse do this with a font dialog}
MultiImage2.MsgFont.Name:='Arial';
{set Message font size}
MultiImage2.MsgFont.Size:=-12;
{set Message font style}
MultiImage2.MsgFont.Style:=[];
{set Message font color}
MultiImage2.MsgFont.Color:=clAqua;
{set Message background. Note you could do this also with a color dialog}
MultiImage2.MsgBkGrnd:=clNavy;
{set Message speed from 1 is fast to 10 is slow}
MultiImage2.MsgSpeed:=7;
{inititiate new message}
MultiImage2.NewMessage;
{IMPORTANT}
{This is the moving engine for all the messages. Since an applcation
can have only one OnIdle Trigger, this trigger needs to be subdivided
by all your moving and animated objects. In this particular case the
function is called TRIGGER but you can name it as you want as long
you have a procedure named the same.}
Application.OnIdle:=Trigger;
If FileExists(ExtractFilePath(Application.ExeName)+'IMAGEL31.HLP') then begin
Application.HelpFile := ExtractFilePath(Application.ExeName)+'IMAGEL31.HLP';
SpeedButton11.Enabled:=True;
end;
ImageToolBar1.PreviewsDir:=ExtractFilePath(Application.Exename);
ThumbPreview1.PreviewsDir:=ExtractFilePath(Application.Exename);
ThumbPreview1.DataFileDir:=ExtractFilePath(Application.Exename);
end;
{---------------------------------------------------------------------}
Procedure TDemoForm1.Trigger(Sender : TObject; Var Done : Boolean);
begin
{This function is called when your app is idle. Subdivide the
trigger event to your ImageLib objects who may need one.
If no Message is active it will not take up significant time}
MultiImage2.Trigger;
PMultiImage1.Trigger;
if DBMultiImageToolbar <> Nil then
DBMultiImageToolbar.PDBMultiImage1.Trigger;
if BForm1 <> Nil then
BForm1.PMultiImage1.Trigger;
if MMForm1 <> Nil then
MMForm1.PDBMultiMedia1.Trigger;
if MMForm3 <> Nil then
MMForm3.PMultiMedia1.Trigger;
end;
{---------------------------------------------------------------------}
procedure TDemoForm1.SpeedButton1Click(Sender: TObject);
begin
FrameGrab:=TFrameGrab.Create(self);
FrameGrab.ShowModal;
FrameGrab.Free;
end;
{---------------------------------------------------------------------}
procedure TDemoForm1.SpeedButton2Click(Sender: TObject);
begin
MultiImage2.Visible:=False;
ViewImageForm:=TViewImageForm.Create(self);
ViewImageForm.ShowModal;
ViewImageForm.Free;
MultiImage2.Visible:=true;
Application.OnIdle:=Trigger;
end;
{---------------------------------------------------------------------}
procedure TDemoForm1.SpeedButton3Click(Sender: TObject);
begin
ConvertForm1:=TConvertForm1.Create(self);
ConvertForm1.ShowModal;
ConvertForm1.Free;
Application.OnIdle:=Trigger;
end;
{---------------------------------------------------------------------}
procedure TDemoForm1.SpeedButton4Click(Sender: TObject);
begin
MultiImage2.Visible:=False;
MMBlobForm:=TMMBlobForm.Create(self);
MMBlobForm.ShowModal;
MMBlobForm.Free;
MultiImage2.Visible:=true;
Application.OnIdle:=Trigger;
end;
{---------------------------------------------------------------------}
procedure TDemoForm1.SpeedButton5Click(Sender: TObject);
begin
MultiImage2.Visible:=False;
BlobForm1:=TBlobForm1.Create(self);
BlobForm1.ShowModal;
BlobForm1.Free;
MultiImage2.Visible:=true;
Application.OnIdle:=Trigger;
end;
{---------------------------------------------------------------------}
procedure TDemoForm1.SpeedButton6Click(Sender: TObject);
begin
MultiImage2.Visible:=False;
MailOrderForm:=TMailOrderForm.Create(self);
MailOrderForm.ShowModal;
MailOrderForm.Free;
MultiImage2.Visible:=true;
Application.OnIdle:=Trigger;
end;
{---------------------------------------------------------------------}
procedure TDemoForm1.SpeedButton7Click(Sender: TObject);
begin
MultiImage2.Visible:=False;
ScrollForm1:=TScrollForm1.Create(self);
ScrollForm1.ShowModal;
ScrollForm1.Free;
MultiImage2.Visible:=true;
Application.OnIdle:=Trigger;
end;
{---------------------------------------------------------------------}
procedure TDemoForm1.SpeedButton8Click(Sender: TObject);
begin
GlobalPalette:=PMultiImage1.Picture.Bitmap.Palette;
GPaletteD:=TGPaletteD.Create(Self);
GPaletteD.ShowModal;
GPaletteD.Free;
GlobalPalette:=0;
end;
{---------------------------------------------------------------------}
procedure TDemoForm1.BitBtn1Click(Sender: TObject);
begin
Memo1.Visible:=False;
BitBtn1.Visible:=False;
BitBtn2.Visible:=False;
end;
{---------------------------------------------------------------------}
procedure TDemoForm1.SpeedButton9Click(Sender: TObject);
begin
Memo1.Lines.Clear;
Memo1.Lines.LoadFromFile(ExtractFilePath(Application.ExeName)+'ILibCust.txt');
Memo1.Visible:=true;
BitBtn1.Visible:=true;
BitBtn2.Visible:=true;
end;
{---------------------------------------------------------------------}
procedure TDemoForm1.SpeedButton10Click(Sender: TObject);
begin
Memo1.Lines.Clear;
Memo1.Lines.LoadFromFile(ExtractFilePath(Application.ExeName)+'ILibRef.txt');
Memo1.Visible:=true;
BitBtn1.Visible:=true;
BitBtn2.Visible:=true;
end;
{---------------------------------------------------------------------}
procedure TDemoForm1.SpeedButton18Click(Sender: TObject);
begin
Memo1.Lines.Clear;
Memo1.Lines.LoadFromFile(ExtractFilePath(Application.ExeName)+'ImageLib.txt');
Memo1.Visible:=true;
BitBtn1.Visible:=true;
BitBtn2.Visible:=true;
end;
{---------------------------------------------------------------------}
procedure TDemoForm1.SpeedButton11Click(Sender: TObject);
begin
Application.HelpJump('');
end;
{---------------------------------------------------------------------}
procedure TDemoForm1.BitBtn3Click(Sender: TObject);
begin
AboutBox.Image1.Picture.BitMap:=PMultiImage1.Picture.BitMap;
AboutBox.ShowModal;
end;
{---------------------------------------------------------------------}
procedure TDemoForm1.BitBtn2Click(Sender: TObject);
var i : integer;
p : integer;
begin
if PrintDialog1.execute then begin
Printer.Begindoc;
p:=0;
For i:=0 to Memo1.Lines.Count -1 do begin
p:=i*45;
Printer.Canvas.Textout(5,P,Memo1.Lines[i]);
end;
Printer.Enddoc;
end;
end;
{---------------------------------------------------------------------}
procedure TDemoForm1.SpeedButton12Click(Sender: TObject);
begin
IconListBoxDlg:=TIconListBoxDlg.Create(Self);
IconListBoxDlg.ShowModal;
IconListBoxDlg.Free;
PMultiImage1.Invalidate;
end;
{---------------------------------------------------------------------}
procedure TDemoForm1.FormActivate(Sender: TObject);
begin
{Write some text over the image}
PMultiImage1.Font.Size:=10;
PMultiImage1.Font.Color:=clLime;
PMultiImage1.Text:='ImageLib 95/31 by SkyLine Tools (c)';
PMultiImage1.TextShadow:=True;
PMultiImage1.TextLeft:=1;
PMultiImage1.TextTop:=PMultiImage1.ClientRect.Top;
PMultiImage1.TextRotate:=0;
PMultiImage1.TextTransParent:=True;
DemoForm1.Caption:='ImageLib 95 Portfolio';
PMultiImage1.Canvas.Pen.Width := 5;
PMultiImage1.Canvas.Pen.Style := psDot;
Randomize;
end;
{---------------------------------------------------------------------}
procedure TDemoForm1.SpeedButton14Click(Sender: TObject);
begin
{Show or hide the toolbar
Note: The toolbar can only be uses on NON modal forms}
ImageToolBar1.ShowToolbar:= not ImageToolBar1.ShowToolbar;
end;
{---------------------------------------------------------------------}
procedure TDemoForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
{Kill the OnIdle just to be save}
Application.OnIdle:=Nil;
{In case the toolbar forms are not nil we could free it}
If BForm1 <> Nil then
BForm1.Free;
If DBMultiImageToolbar <> Nil then
DBMultiImageToolbar.Free;
If MMForm1 <> Nil then
MMForm1.Free;
If MMForm3 <> Nil then
MMForm3.Free;
end;
{---------------------------------------------------------------------}
procedure TDemoForm1.SpeedButton13Click(Sender: TObject);
begin
{This from includes a toolbar so that we must show it non modal}
If BForm1 = Nil then
BForm1:=TBForm1.Create(self);
BForm1.Show;
end;
{---------------------------------------------------------------------}
procedure TDemoForm1.SpeedButton15Click(Sender: TObject);
begin
{This from includes a toolbar so that we must show it non modal}
If DBMultiImageToolbar = Nil then
DBMultiImageToolbar:=TDBMultiImageToolbar.Create(self);
DBMultiImageToolbar.Show;
end;
{---------------------------------------------------------------------}
procedure TDemoForm1.SpeedButton16Click(Sender: TObject);
begin
{This from includes a toolbar so that we must show it non modal}
If MMForm1 = Nil then
MMForm1:=TMMForm1.Create(self);
MMForm1.Show;
end;
{---------------------------------------------------------------------}
procedure TDemoForm1.SpeedButton17Click(Sender: TObject);
begin
{This from includes a toolbar so that we must show it non modal}
If MMForm3 = Nil then
MMForm3:=TMMForm3.Create(self);
MMForm3.Show;
end;
{---------------------------------------------------------------------}
procedure TDemoForm1.SpeedButton19Click(Sender: TObject);
begin
{This from includes a toolbar so that we must show it non modal}
If RubberbandForm = Nil then
RubberbandForm:=TRubberbandForm.Create(self);
RubberbandForm.Show;
end;
{---------------------------------------------------------------------}
end.